package com.netty;

import com.netty.source.ClientStart;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.string.StringEncoder;

public class NettyStudyDemoClientMain {

    public static void main(String[] args) {
        ClientStart clientMain = new ClientStart(
                new StringEncoder(),
                new ChannelInboundHandlerAdapter() {
                    @Override
                    public void channelActive(ChannelHandlerContext ctx) throws Exception {
                        // ctx.writeAndFlush("Hello xl-9527");
                        // not need deliver event，but this has bug。can't get pipeline
                        final ChannelPipeline pipeline = ctx.channel().pipeline();
                        pipeline.writeAndFlush("Hello xl-9527");
                        // super.channelActive(ctx);
                    }
                }
        );
        clientMain.doStart();
    }
}
